/*
 * Instruction00.java
 *
 * Created on March 21, 2007, 9:33 PM
 *
 *
 *
 */

/*

BGND operates like a software interrupt, except that no registers are
stacked. First, the current PC value is stored in internal CPU register
TMP2. Next, the BDM ROM and background register block become
active. The BDM ROM contains a substitute vector, mapped to the
address of the software interrupt vector, which points to routines in the
BDM ROM that control background operation. The substitute vector is
fetched, and execution continues from the address that it points to.
Finally, the CPU checks the location that TMP2 points to. If the value
stored in that location is $00 (the BGND opcode), TMP2 is incremented,
so that the instruction that follows the BGND instruction is the first
instruction executed when normal program execution resumes.
For all other types of BDM entry, the CPU performs the same sequence
of operations as for a BGND instruction, but the value stored in TMP2
already points to the instruction that would have executed next had BDM
not become active. If active BDM is triggered just as a BGND instruction
is about to execute, the BDM firmware does increment TMP2, but the
change does not affect resumption of normal execution.
While BDM is active, the CPU executes debugging commands received
via a special single-wire serial interface. BDM is terminated by the
execution of specific debugging commands. Upon exit from BDM, the
background/boot ROM and registers are disabled, the instruction queue
is refilled starting with the return address pointed to by TMP2, and
normal processing resumes.
BDM is normally disabled to avoid accidental entry. While BDM is
disabled, BGND executes as described, but the firmware causes
execution to return to the user program. Refer to Section 8. Instruction
Queue for more information concerning BDM.
 
 
 */

package moto9s12sim;

/*
 *
 * @author Fergus Earnshaw
 *
 */
public class Instruction00 extends Instruction {
    
    /** Creates a new instance of Instruction00 */
    public Instruction00()
    {
        this.strAssemblyCode = "BGND";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("00",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        cpu.PC.inc();
        
        //TO DO see page 127;
        
        printInstruction(cpu);
        
        return true;
    }   
    
}
